package org.Vancl.servlet;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.Vancl.Dao.userDao;
import org.Vancl.Dao.ImpI.userDaoImpl;
import org.Vancl.entity.User;

@WebServlet(urlPatterns="/checkname.shtml")
public class checkname extends HttpServlet {
	@Override
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		String name=request.getParameter("name");
		
		userDao ud=new userDaoImpl();
		User username=ud.getname(name);
		
		PrintWriter out=response.getWriter();
		if (username==null) {
			out.print(false);
		}else {
			out.print(true);
		}
	}
	
	@Override
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		this.doGet(request, response);
	}
}
